***** Coding variables *****

 replace GRlux_A = . if (GRlux_A <= -1)
replace GRchild_A = . if (GRchild_A <= -1)
replace GRcook_A = . if (GRcook_A <= -1)
replace GRmarr_A = . if (GRmarr_A <= -1)
replace GRhc_A = . if (GRhc_A <= -1)
replace GRrel_A = . if (GRrel_A <= -1)
replace GRshop_A = . if (GRshop_A <= -1)
replace GRmandi_A = . if (GRmandi_A <= -1)
replace GR_hh_meal = . if (GR_hh_meal <= -1)
*** rename GR_hh_meal to make it a dummy where the 1 is where everyone east to together 
gen GR_hh_meal_together = 0
replace GR_hh_meal_together = 1 if GR_hh_meal == 1
replace GR_hh_meal_together = . if GR_hh_meal == .
replace GR_hh_cash = . if (GR_hh_cash <= -1)
replace GR_hh_ac = . if (GR_hh_ac <= -1)
replace GR_hh_prop = . if (GR_hh_prop <= -1)
*** since no house/ppers is also a blank in this case, i replace that with .
replace GR_hh_prop = . if (GR_hh_prop == 8)
gen pol_disc_yes = 1
replace pol_disc_yes = 0 if pol_disc == 0
replace pol_disc_yes = . if pol_disc == .

replace pol_hhworker = . if (pol_hhworker == -1)
replace pol_disc = . if (pol_disc <= -1)
gen pol_disc_neverdummy = 0
replace pol_disc_neverdummy = 1 if pol_disc == 0
replace pol_disc_neverdummy = . if pol_disc == .

replace pol_immu = . if (pol_immu <= -1)
gen pol_immu_dummy = 1
replace pol_immu_dummy = 0 if pol_immu == 0
replace pol_immu_dummy = . if pol_immu == .

replace pol_icds= . if (pol_icds <= -1)
gen pol_icds_dummy = 1
replace pol_icds_dummy = 0 if pol_icds == 0
replace pol_icds_dummy = . if pol_icds == .

**** Create a new dummmy for DIL 

tab EW_relhh
*** We see that the DIL is coded as 4. We want to specifically control for being a DIL 
**** bc that will mean you have lesser say on things. 
gen dil_dummy = 0
replace dil_dummy = 1 if EW_relhh == 4
replace dil_dummy = . if EW_relhh <= -1


*** Now, we know that the wife of the ehad is also likely to have more say so we will also control for that

gen wifeofhead_dummy = 0
replace wifeofhead_dummy = 	1 if EW_relhh == 2
replace wifeofhead_dummy = . if EW_relhh <= -1

*** make a dummy for whether or not they are in the another state or abroad
gen anotherst_dummy = 0
replace anotherst_dummy = 	1 if NR8 == 2
replace anotherst_dummy = 	1 if NR8 == 3


gen same_stdummy = 0
replace same_stdummy = 1 if NR8 == 1



**** create a dummy for hindu

gen rel_hindu = 0 
** we want to include all - Brahmin, dalit, adivasi (ST) and OBC in it. 
replace rel_hindu = 1 if GROUPS8 <= 5
replace rel_hindu = . if GROUPS8 == .


**** create a dummy for muslimm

gen rel_muslim = 0 
** we want to include all - Brahmin, dalit, adivasi (ST) and OBC in it. 
replace rel_muslim = 1 if GROUPS8 == 6
replace rel_muslim = . if GROUPS8 == .

*** create for caste

** we want to include all - Brahmin, dalit, adivasi (ST) and OBC in it. 
replace caste = 0 if GROUPS8 > 5
replace caste = . if GROUPS8 == .


*** NR edu -- but cannot use this in the reg with non-mig 
gen NR_edu = cond(NR10 > 12, 3 , cond(NR10 > 5, 2, cond(NR10>1,1, 0)))
replace NR_edu = . if NR10 == .

gen log_inc = ln(INCOME)

gen sc = 0
replace sc = 1 if GROUPS8 == 4


gen obc = 0
replace obc = 1 if GROUPS8 ==3

gen st = 0
replace st = 1 if GROUPS8 ==5




**** creating the indices

** Now make new Vars for the Index 

*** 1. DEC making 
gen dec_score = GRlux_A + GRchild_A + GRcook_A + GRmarr_A
gen dec_score_norm = (dec_score-0)/4


** create a dummy that encopasses ALL membership variables 
** if they participate in at least 1 then it is scored as 1.

gen pol_mem_all = 0
replace pol_mem_all = 1 if pol_mem_mm == 1 | pol_mem_shg == 1 | pol_mem_cred == 1 | pol_mem_porg==1

** 2. Mobility
gen mob_rel = 0
replace mob_rel = 1 if GRrel_A == 0

gen mob_hc = 0
replace mob_hc = 1 if GRhc_A == 0

gen mob_shop = 0
replace mob_shop = 1 if GRshop_A == 0

**** For mandi the coding remains the same 
gen mob_mandi = 0
replace mob_mandi = 1 if GRmandi_A == 1
**mob_score
gen mob_score_old = mob_mandi + mob_shop + mob_hc + mob_rel
** now since there are 3323 women with a score of 0 bc they do not have any mobility
** if I log the var they will be dropped. So I add 1 to the score so min is now 1 
gen mob_score = mob_score_old + 1
** drop that variable 

drop mob_score_old

** log the MOBILITy SCORE
gen mob_score_norm = (mob_score-1)/4


** pol score 

** NOTE I DROPPED pol HH Worker bc it wasn't working with it. Also, is it really pol participation?
gen pol_score =  pol_disc_yes + pol_immu_dummy + pol_icds_dummy
gen pol_score_norm = (pol_score-0)/3
replace pol_score_norm = . if pol_score_norm < 0

*** here I seprarte them out bc if I combine like above I lose a lot of data points


**1. pol_disc - as it is 

gen pol_disc_norm = (pol_disc-0)/3
replace pol_disc_norm = . if pol_disc_norm < 0

**2. pol knowledge 
gen pol_know = pol_immu_dummy + pol_icds_dummy
gen pol_know_norm = (pol_know-0)/2
replace pol_know_norm = . if pol_know_norm < 0

